Repository navigation
IBM: evaluate a rotating body's ghost-cell wall velocity at the wall point - #2383
Conversation
|
Claude Code Review Head SHA: 9e158cf Files changed:
Findings: |
Lines of Code
|
…and the 2-rank AMR force-driven goldens
|
CI (full suite, Coverage lane) found three changed goldens that my first regeneration missed because it skipped the example tests and the multi-rank variants: This comment was made with Claude Code (AI). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2383 +/- ##
==========================================
+ Coverage 65.72% 66.14% +0.42%
==========================================
Files 111 112 +1
Lines 30549 31096 +547
Branches 4673 4749 +76
==========================================
+ Hits 20079 20570 +491
+ Misses 6699 6675 -24
- Partials 3771 3851 +80 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contribution Policy
All contributions are expected to demonstrate:
If these expectations are not met, we would prefer to implement the changes ourselves rather than spend time reviewing low-effort submissions.
Summary
s_compute_ghost_point_velocity(src/simulation/m_ibm.fpp) evaluated a rotating body's wall velocity at the ghost point,f_wall_velocity(gp_patch_id, radial_vector)withradial_vectorthe centroid-to-ghost vector. The ghost point lies |levelset| inside the body, so a rotating circle imposed a wall speed Omega (R - |ls|) instead of Omega R: up to about dx/R of the wall speed (5 % at 20 cells/R), which is more than 100 % of the shear across one cell.s_compute_ghost_point_pressurealready used the wall pointr_w = radial_vector + |ls| n.The fix factors that wall point into
f_wall_point(shared by the pressure routine, so no duplicated construction) and evaluates the body's velocity there once, for both the no-slip and slip branches. It has no per-body or per-step global work, assigns every private unconditionally, and follows the existingGPU_ROUTINEconventions. Translating-only and fixed bodies have a uniform wall velocity, so they are unchanged. This is a CFD-result change for rotating bodies only.Separate observation, not part of this PR: the default no-slip ghost value on a static wall is first order (the wall sits about 0.7 cell inside); second order is the opt-in
ib_wall_order = 2.Verification
Taylor-Couette (
examples/2D_ibm_taylor_couetteof #2373: inner cylinder rotating, fixed outer STL ring at 2R, ideal gas, constant mu, WENO5, HLLC, RK3, exact incompressible initial field, serial CPU, GNU 13). Inner/outer wall-shear rms relative error (local cubic fits at 96 wall points) and torque ratio B/B_exact; analytic reference u = A r + B / r. "Before" is master, "after" this PR.Regime A (annulus): Mach 0.01, Re 11.
Regime A2 (same annulus geometry, second parameter set): Mach 0.05, Re 40.
The outer (fixed) wall is unchanged by the fix, as expected. With the default (first-order) ghost the inner shear is still 20 to 29 % because that ghost is first order on a curved wall; the torque error at 30 cells/R changes sign with similar magnitude (+0.41 % to -0.37 %), so the default option set does not converge faster, it only removes the rotating-specific part. With
ib_wall_order = 2the inner shear drops 5 to 25 times and the torque is within 0.01 to 0.04 % at both grids and in both regimes. Combined withib_ip_interp = 2andib_visc_compact = Tat 20 cells/R (Regime A) the inner shear is 0.0065 and the outer 0.0016.Regime B (different geometry, no outer IB ring): a circle of radius R spinning at Omega in a square box of half-width 3R with no-slip domain-boundary walls (
bc = -16), gas initially the Couette field of R_o = 3R, Mach 0.05, Re = Omega R^2 / nu = 1, run to t = 30 (the torque still drifts by about 0.04 % per tenth of the run, so it is steady to that level), GNU 13 CPU, serial. The square box has no closed-form solution. The annulus value for R_o = 3R, T = 4 pi mu Omega R^2 R_o^2/(R_o^2 - R^2) = 3.534e-2, and the unbounded 2D value without the box correction, 3.142e-2, bracket it, so they are bounds only. The reference used is the numerical torque of this PR withib_wall_order = 2at 40 cells/R (3.504e-2, equivalent annulus R_o = 3.15R, inside the bracket). Its uncertainty is not tight: the same option set gives 3.491, 3.492, 3.493, 3.504 (e-2) at 16, 24, 32, 40 cells/R, a 0.35 % spread, so errors below about 0.3 % are not resolved. Error columns are relative to that reference; u(r = 1.1R) is the azimuthal-mean u_theta from a local linear fit, compared with the reference run at the same radius.The wall-speed defect shows as a torque and near-wall velocity deficit of the same size at every resolution that the fix removes; before the fix the second-order option converges to the reference only at first order (-2.9, -2.6, -1.7, -1.3 %), after it the torque is flat to 0.35 %. The first-order default is still 1 to 3 % low, as in the annulus.
3D sphere (the same box setup in 3D,
fd_order = 2): a sphere of radius R spinning at Omega = 0.1 in a cubic box of half-width 2.5R with no-slip walls, Mach 0.1, Re = 1, started from rest, t = 20 (torque drift below 0.05 % per tenth of the run except 0.4 % in the base 16 cells/R run), serial GNU 13 CPU. The unbounded Stokes torque 8 pi mu Omega R^3 = 0.2513 is a lower bound for any enclosed box; the sphere-in-sphere value with R_o = 2.5R, 0.2685, is an upper bound for this cube, and the volume-equivalent sphere (R_o = 3.1R) gives about 0.260. Torque magnitude (Mach 0.1 adds an O(M^2) of about 1 %):With the fix and
ib_wall_order = 2the torque lies inside the bracket 0.2513 to 0.2685 at every resolution and near the volume-equivalent estimate (0.260; +0.4 to +1.2 %). Before the fix it is at or just below the unbounded-Stokes lower bound (0.2507 at 8, 0.2522 at 12, 0.2558 at 16 cells/R) and creeps upward with resolution. The default (first-order) ghost stays below the lower bound even with the fix (0.2426, 0.2458 against 0.2513; before 0.2340, 0.2384), as in 2D. This is a bracketing check, not an analytic one.Translation plus spin. Direct probe of the ghost-velocity routine (scratch build with a print, not in the PR): a circle with U = 0.05 along x, Omega = 0.05 (R = 1) in a periodic box with the gas at U, 24 cells/R, first RK stages, 8100 ghost points. The wall point is exactly on the circle (|r_w| - R below 3e-16). The imposed velocity minus U + Omega x (R r_hat) is 1.6e-17 at most with the fix (roundoff). Before the fix the error was Omega |levelset|, up to 8.8e-3 (mean 4.0e-3), i.e. 18 % of the spin speed at the deepest ghost point and 8 % on average (the ghost layer reaches up to 0.18R inside). Galilean check: the final torque (t = 15, still developing from rest) of the same body with U = 0.05 and gas at U, relative to U = 0 (the same physical problem): -5.8 % before, -3.3 % after with the default ghost; -3.3 % before, -0.2 % after with
ib_wall_order = 2; the lateral force on the U = 0.05 body is -4.5e-4 before and -2.3e-5 after (ib_wall_order = 2), against an exact zero at U = 0. The remainder is the discretisation error of a body and flow crossing the grid, not roundoff: this is not bitwise Galilean invariance, only a large improvement.Tests, what was compared.
./mfc.sh test --generatewas run on master and on this branch (GNU 13 double CPU, no MPI,--no-examples) for the IBM label (117 tests) and the master and branch goldens were compared byte for byte; they differ only in the tests listed below (two more, 09FDDC81 and 6DE4C39D, differ at roundoff, 2e-14 and 4e-29 of the field scale, and pass at the test tolerance). The whole non-example suite (794 tests) was also regenerated on the branch and compared with the committed goldens: apart from the listed tests all differ at machine roundoff only (below 1e-10 of the field scale, which is the platform noise between the original generators and this one). That first regeneration did not cover the example tests or the multi-rank (MPI) variants; CI found three more changed goldens there (the Example testsrotating_sphereandtumbling_rectangle, and the 2-rank sibling of the force-driven AMR case), which were regenerated afterwards on a GNU 12.3 + OpenMPI 4.1.5 CPU MPI build (Georgia Tech Phoenix) and re-run to pass. The three remaining failures on the Phoenix OpenMP lanes (MPI Consistency -> 3D -> Bubbles, twoReactive Shocktube AMR2-rank chemistry cases) are "Failed to execute MFC" on tests with no immersed body.Goldens regenerated (max |change| relative to the largest golden value, master vs this PR). The prescribed-rotation tests, including the two examples, move by 1e-3 to 4e-2; the others are two-way coupled bodies that spin up under torque, so only the rotational part of the wall velocity moves.
Translation is unaffected:
Translating Circleis bitwise unchanged whileTranslating Spinning Circle(same case with angular_vel = 3) moves by 3.8e-2, and the wall velocity is the sum translation + omega x r_w byf_wall_velocity.The first 9 goldens plus
Static Circle With Angular Velocity,Translating CircleandAdaptive dt(one of them roundoff-level changed, the others unchanged) pass on NVIDIA A100 80GB (Georgia Tech wingtip), NVHPC 25.5 OpenACC, against the regenerated goldens (the 2 AMR cases in a second run); the change is arithmetic and agrees with the CPU build.golden-metadata.txtis committed as generated.Not verified: a tight analytic reference for the boxed spinning cylinder (the reference is numerical, uncertain to about 0.3 %; the box cases above are no-slip box walls and a periodic box only), higher-Re or compressible spin (Mach 0.05 only), AMR beyond the two golden cases, moving plus deforming bodies, CCE/AMD (CI lanes), more than 2 ranks. Boxed cases above 40 cells/R were not obtained: at 48 and 64 cells/R every variant, with and without this PR, produced NaN at a box corner when the first pressure wave reached the walls (a no-slip domain-corner issue unrelated to this change, not investigated).
Type of change
Testing
./mfc.sh precheck; goldens regenerated and compared as above; Couette tables above on GNU 13 CPU.This PR was made with Claude Code (AI).